package org.example.osproject01.Object;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

import java.util.UUID;

public class Item {
    private StringProperty id = new SimpleStringProperty();
    private StringProperty name = new SimpleStringProperty();
    private StringProperty submitTime = new SimpleStringProperty();
    private StringProperty runTime = new SimpleStringProperty();
    private StringProperty cyclingTime = new SimpleStringProperty();
    private StringProperty weightedTime = new SimpleStringProperty();
    private StringProperty finishTime = new SimpleStringProperty();
    private StringProperty runStatus = new SimpleStringProperty();
    private StringProperty spaceStatus = new SimpleStringProperty();
    private StringProperty needSpace = new SimpleStringProperty();
    private StringProperty atWhere = new SimpleStringProperty();
    private StringProperty needTape = new SimpleStringProperty();
    private StringProperty priority = new SimpleStringProperty();
    private StringProperty rrunTime = new SimpleStringProperty();

    // 构造函数
    public Item(UUID id, String name, int submitTime, int runTime, int cyclingTime, double weightedTime , int finishTime, String runStatus, String spaceStatus, int needSpace, String atWhere, int needTape, int priority) {
        // 假设id是一个包含完整UUID的字符串
        String sid = String.valueOf(id);
        // 使用substring方法截取前八位
        String uuidFirstEight = sid.substring(0, 8);
        this.id.set(uuidFirstEight);
        this.name.set(name);
        this.submitTime.set(String.valueOf(submitTime));
        this.runTime.set(String.valueOf(runTime));
        this.cyclingTime.set(String.valueOf(cyclingTime));
        this.weightedTime.set(String.valueOf(weightedTime));
        this.finishTime.set(String.valueOf(finishTime));
        this.runStatus.set(runStatus);
        this.spaceStatus.set(spaceStatus);
        this.needSpace.set(String.valueOf(needSpace));
        this.atWhere.set(String.valueOf(atWhere));
        this.needTape.set(String.valueOf(needTape));
        this.priority.set(String.valueOf(priority));
        this.rrunTime.set(String.valueOf(runTime));
    }

    public String getRrunTime(){
        return rrunTime.get();
    }

    public String getPriority() {
        return priority.get();
    }

    public StringProperty priorityProperty() {
        return priority;
    }

    public void setPriority(String priority) {
        this.priority.set(priority);
    }

    public String getAtWhere() {
        return atWhere.get();
    }

    public StringProperty atWhereProperty() {
        return atWhere;
    }

    public void setAtWhere(String atWhere) {
        this.atWhere.set(atWhere);
    }

    public String getWeightedTime() {
        return weightedTime.get();
    }

    public StringProperty weightedTimeProperty() {
        return weightedTime;
    }

    public void setWeightedTime(String weightedTime) {
        this.weightedTime.set(weightedTime);
    }
    public String getId() {
        return id.get();
    }

    public StringProperty idProperty() {
        return id;
    }

    public void setId(String id) {
        this.id.set(id);
    }

    public String getName() {
        return name.get();
    }

    public StringProperty nameProperty() {
        return name;
    }

    public void setName(String name) {
        this.name.set(name);
    }

    public String getSubmitTime() {
        return submitTime.get();
    }

    public StringProperty submitTimeProperty() {
        return submitTime;
    }

    public void setSubmitTime(String submitTime) {
        this.submitTime.set(submitTime);
    }

    public String getRunTime() {
        return runTime.get();
    }

    public StringProperty runTimeProperty() {
        return runTime;
    }

    public void setRunTime(String runTime) {
        this.runTime.set(runTime);
    }

    public String getCyclingTime() {
        return cyclingTime.get();
    }

    public StringProperty cyclingTimeProperty() {
        return cyclingTime;
    }

    public void setCyclingTime(String cyclingTime) {
        this.cyclingTime.set(cyclingTime);
    }

    public String getFinishTime() {
        return finishTime.get();
    }

    public StringProperty finishTimeProperty() {
        return finishTime;
    }

    public void setFinishTime(String finishTime) {
        this.finishTime.set(finishTime);
    }

    public String getRunStatus() {
        return runStatus.get();
    }

    public StringProperty runStatusProperty() {
        return runStatus;
    }

    public void setRunStatus(String runStatus) {
        this.runStatus.set(runStatus);
    }

    public String getSpaceStatus() {
        return spaceStatus.get();
    }

    public StringProperty spaceStatusProperty() {
        return spaceStatus;
    }

    public void setSpaceStatus(String spaceStatus) {
        this.spaceStatus.set(spaceStatus);
    }

    public String getNeedSpace() {
        return needSpace.get();
    }

    public StringProperty needSpaceProperty() {
        return needSpace;
    }

    public void setNeedSpace(String needSpace) {
        this.needSpace.set(needSpace);
    }

    public String getNeedTape() {
        return needTape.get();
    }

    public StringProperty needTapeProperty() {
        return needTape;
    }

    public void setNeedTape(String needTape) {
        this.needTape.set(needTape);
    }

    @Override
    public String toString() {
        return "Item{" +
                "id=" + id +
                ", name=" + name +
                ", submitTime=" + submitTime +
                ", runTime=" + runTime +
                ", cyclingTime=" + cyclingTime +
                ", finishTime=" + finishTime +
                ", runStatus=" + runStatus +
                ", spaceStatus=" + spaceStatus +
                ", needSpace=" + needSpace +
                ", needTape=" + needTape +
                '}';
    }
}
